package Thread;

/**
 * 第二张线程创建方式：实现Runnable接口单独定义线程
 */
public class ThreadDemo2 {
    public static void main(String[] args) {
        Runnable r1 = new Runnable1();
        Runnable r2 = new Runnable2();
        Thread t1 = new Thread(r1);
        Thread t2 = new Thread(r2);

        t1.start();
        t2.start();
    }
}

class Runnable1 implements Runnable{
    @Override
    public void run() {
        for (int i = 0; i < 1000; i++) {
            System.out.println("好好学习");
        }
    }
}

class Runnable2 implements Runnable{
    @Override
    public void run() {
        for (int i = 0; i < 1000; i++) {
            System.out.println("天天向上");
        }
    }
}
